package org.canx;

import org.canx.config.SessionInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Andrew Qian
 * @class description : 程序入口
 * @time 2017年7月14日 下午4:02:59
 */

@SpringBootApplication
public class App extends WebMvcConfigurerAdapter {
    public static void main(String[] args) {
        // 注意run后面的class名是否修改
        SpringApplication.run(App.class, args);
    }

    @Bean
    public HandlerInterceptor getMyInterceptor(){
        return new SessionInterceptor();
    }

    // 增加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getMyInterceptor()).excludePathPatterns("/login/pass", "/login/setck");
    }

}
